﻿namespace DotNetUtility.Parser.Test
{
    using System;
    using NUnit.Framework;

    [TestFixture]
    public class NumericParserTest
    {
        [Test]
        public void ParseInt32_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            Int32 expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToInt32(textToParse));
        }

        [Test]
        public void ParseInt32_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            Int32 expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToInt32(textToParse));
        }

        [Test]
        public void ParseInt64_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            Int64 expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToInt64(textToParse));
        }

        [Test]
        public void ParseInt64_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            Int64 expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToInt64(textToParse));
        }

        [Test]
        public void ParseToDecimal_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            decimal expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToDecimal(textToParse));
        }

        [Test]
        public void ParseToDecimal_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            decimal expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToDecimal(textToParse));
        }

        [Test]
        public void ParseToByte_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            byte expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToByte(textToParse));
        }

        [Test]
        public void ParseToByte_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            Byte expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToByte(textToParse));
        }

        [Test]
        public void ParseToSingle_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            Single expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToSingle(textToParse));
        }

        [Test]
        public void ParseToSingle_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            Single expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToSingle(textToParse));
        }

        [Test]
        public void ParseToDouble_ExpectedResult_And_Parsevalue_Same()
        {
            string textToParse = "2";
            double expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToDouble(textToParse));
        }

        [Test]
        public void ParseToDouble_ExpectedResult_And_Parsevalue_Not_Same()
        {
            string textToParse = "KHKHJGJGJG2";
            double expectedResult = 2;
            Assert.AreEqual(expectedResult, NumericParser.ParseToDouble(textToParse));
        }

    }
}
